{% extends "base.html" %}
{% load i18n plmapp_tags %}

<!-- Manage html display in the Content div which correspond to the "children" menu -->

{% block content %}
<form method="POST" action="">{% csrf_token %}
    {{ children_formset.management_form }}
    <table class="Content">
        <tr>
            <th class="Content">{% trans "Order" %}</th>
            <th class="Content">{% trans "Quantity" %} </th>
            <th class="Content" style="width:50px"> {% trans "Unit" %}</th>
            <th class="Content"> {{ obj.reference }} </th>
            <th class="Content"> {{ obj.revision }} </th>
            <th class="Content"> {{ obj.type }} </th>
            <th class="Content"> {{ obj.name }} </th>
            {% for field, verbose_name in extra_columns %}
                <th class="Content"> {{ verbose_name|capfirst }} </th>
            {% endfor %}
            <th class="Content"> {{ obj.state.name }} </th>
            <th class="Content"> {% trans "Delete ?" %} </th>
        </tr>
        {% for form in children_formset.forms %}
            {{ form.id }}
            {{ form.parent }}
            {{ form.child }}
            <tr class="Content"> 
                <td class="Content"> {{ form.order }} </td>
                <td class="Content"> {{ form.quantity }} </td>
                <td class="Content" style="width:50px"> {{ form.unit }} </td>
                <td class="Content"> 
                    <a href="{{form.instance.child.plmobject_url}}">
                        {{ form.instance.child.reference }}</a>
                    —
                    <a href="../replace/{{form.instance.id}}/">
                    <span>{% trans "(replace)" %}</span></a>
                </td>
                <td class="Content"> {{ form.instance.child.revision }} </td>
                <td class="Content"> {{ form.instance.child.type }} </td>
                <td class="Content"> {{ form.instance.child.name }} </td>
                {% for field in extra_fields %}
                    <td class="Content"> {{ form|key:field }} </td>
                {% endfor %}
                <td class="Content"> {{ form.instance.child.state.name }} </td>
                <td class="Content"> {{ form.delete }} </td>
            </tr>
        {% endfor %}
    </table>
    <input type="submit" class="tb-btn tb-btn-primary" value="{% trans "Validate" %}" name="_validate"/>
    <input type="submit" class="tb-btn" value="{% trans "Undo" %}" name="_undo"/>
</form>
{% endblock %}


